package init

import (
	"fmt"
	"github.com/cloudwego/kitex/client"
	"hxzhz/global/model"
	location "hxzhz/kitex_gen/hertz/location/locationservice"
	route "hxzhz/kitex_gen/hertz/route_budget/routebudgetservice"
)

func Init() {
	LocateSrvConn()
	WayBuildSrcConn()
}

func WayBuildSrcConn() {
	newClient, err := route.NewClient("route", client.WithDestService("127.0.0.1:50052"))
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("create new route client")
	model.RC = newClient
}

func LocateSrvConn() {
	Client, err := location.NewClient("location", client.WithDestService("127.0.0.1:50051"))
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("create new location client")
	model.LC = Client
}
